package com.light.mytext.mvp

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.light.mytext.R
import kotlinx.android.synthetic.main.activity_m_v_p.*

class MVPActivity : AppCompatActivity(), IMainView {
    lateinit var mMainViewPresenter: MainViewPresenter
    var index = 0
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_m_v_p)
        init_Presenter()
        init_Listener()
    }

    fun init_Listener() {
        tv_update.setOnClickListener {
            index++
            mMainViewPresenter.modifyTextViewInfo("更新数据${index}")
        }
    }

    fun init_Presenter() {
        mMainViewPresenter = MainViewPresenter(this)
    }


    override fun getTextInfo(): String? {
        return tv_info.text.toString()
    }

    override fun setTextInfo(info: String) {
        tv_info.text = info
    }

}